import EditModalForm from '@/components/EditModalForm';
import SystemDictDataSelect from '@/pages/system/dictData/references/SystemDictDataSelect';
import { EditModalProps } from '@/typing';
import {
  ProFormDigit,
  ProFormItem,
  ProFormText,
  ProFormTextArea,
} from '@ant-design/pro-components';
import React from 'react';

const SystemRoleEditModal: React.FC<EditModalProps> = (props) => {
  return (
    <EditModalForm {...props}>
      <ProFormText
        label={'角色名称'}
        name={'roleName'}
        rules={[{ required: true, message: '请输入角色名称！' }]}
      />
      <ProFormText
        label={'权限字符'}
        name={'roleKey'}
        tooltip={
          '控制器中定义的权限字符，如：@PreAuthorize("@ss.hasRole(\'admin\')")'
        }
        rules={[{ required: true, message: '请输入权限字符！' }]}
      />
      <ProFormDigit
        label={'角色顺序'}
        name={'roleSort'}
        min={0}
        max={9999}
        rules={[{ required: true }]}
      />
      <ProFormItem label={'状态'} name={'status'} rules={[{ required: true }]}>
        <SystemDictDataSelect
          typeCode={'sys_normal_disable'}
          valueInLabel={false}
        />
      </ProFormItem>
      <ProFormTextArea label={'备注'} name={'remark'} />
    </EditModalForm>
  );
};

export default SystemRoleEditModal;
